#ifndef ASTAR_H
#define ASTAR_H

#include <mainwindow.h>
#include <maplabel.h>
#include <QList>
#include <QRadioButton>
#include <QMessageBox>

struct Astarnode{
  int cost;
  QPoint lastpoint;
  bool isClosed;
  int x;
  int y;
  int g;
  int h;
  bool isInOpenList;
};

class Astar : public MapLabel{
public:
    Astar(const QString &text, QWidget *parent=nullptr,int width=5,int height=5);
    void runAstar();
    void clearways();
private:
    Astarnode anode[120][120];
    QList<Astarnode> openlist;
    int startx;
    int starty;
    int endx;
    int endy;
    void updateandpaint();
    void putopenlist(QList<Astarnode> & list, Astarnode data);
    Astarnode getopenlist(QList<Astarnode> & list);
    void resortopenlist(QList<Astarnode> &list, Astarnode data);
    bool issolved;
    void notfound();
};

#endif // ASTAR_H
